package pl.edu.agh.podyplomowe;

import java.util.ArrayList;
import java.util.List;

public class TripsManager {
	
	List<Trip> trips = new ArrayList<Trip>();
	
	public void addTrip(Trip trip) {
		trips.add(trip);
	}
	
	public List<Trip> getTrips() {
		return trips;
	}
	
	public Trip findTrip(String keyword) {
		for (Trip trip: trips) {
			if ((trip.getName().contains(keyword))||(trip.getDescription().contains(keyword))) {
				return trip;// = trip;
			}
		}
		return null;	
	}
	
	public void removeTrip (Trip trip) {
		trips.remove(trip);
	}
}
